﻿namespace Filters.Demo.CustomFilters
{
    using System;
    using System.Drawing;

    /// <summary>
    /// EdgePoint class
    /// </summary>
    public class EdgePoint
    {
        private readonly Point imgPoint;
        private readonly double magnitude;
        private readonly double direction;
        
        public EdgePoint(Point point, double gradientMagnitude, double gradientDirection)
        {
            this.imgPoint = point;
            this.magnitude = gradientMagnitude;
            this.direction = gradientDirection;
        }

        // ImgPoint property
        public Point ImgPoint
        {
            get { return this.imgPoint; }
        }

        // Magnitude property
        public double Magnitude
        {
            get { return this.magnitude; }
        }

        // Direction property
        public double Direction
        {
            get { return this.direction; }
        }

        public double DistanceTo(EdgePoint dst)
        {
            return Math.Max(Math.Abs(this.ImgPoint.X - dst.ImgPoint.X), Math.Abs(this.ImgPoint.Y - dst.ImgPoint.Y));
        }
    }
}
